<template>
	<view>
		<view class="">
			<view class="center "
				style="width: 94%;height: 100%;background-color: white;margin: 20rpx auto;border-radius: 20rpx;">
				<view class="d-flex bb" @tap="changePhone">
					<view class="flex-1 mt-3 mb-3 ml-2 fs28 ls2">修改手机号</view>
					<image class="m-2 mt-4" src="@/static/img/user/right.png" mode="widthFix" style="width: 15rpx;">
					</image>
				</view>
				<view class="d-flex bb" @tap="changCode">
					<view class="flex-1 mt-3 mb-3 ml-2 fs28 ls2">修改登陆密码</view>
					<image class="m-2 mt-4" src="@/static/img/user/right.png" mode="widthFix" style="width: 15rpx;">
					</image>
				</view>
				<view class="d-flex bb" @click="deleteAccount">
					<view class="flex-1 mt-3 mb-3 ml-2 fs28 ls2">注销账户</view>
					<image class="m-2 mt-4" src="@/static/img/user/right.png" mode="widthFix" style="width: 15rpx;">
					</image>
				</view>

			</view>

		</view>

		<uni-popup ref="alert2" type="dialog">
			<uni-popup-dialog :type="msgType" title="退出确认" content="" @confirm="confirm2">
				<view class="" style="font-size: 30rpx;">
					确定要注销该账号吗？
				</view>
			</uni-popup-dialog>
		</uni-popup>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				msgType: 'info',
			}
		},
		methods: {
			changePhone() {
				uni.navigateTo({
					url: './changePhone'
				})
			},
			changCode() {
				uni.navigateTo({
					url: './changeCode'
				})
			},

			deleteAccount() {
				this.$refs.alert2.open()
			},

			async confirm2() {
				let url = '/deleteAccount';

				let res = await this.$myRequest({
					url: url,
					data: {
						token: uni.getStorageSync('token')
					},
					methods: 'post'
				})

				this.$api.msg(res.data.msg);
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/login/login'
					})
				}, 1500)
			}
		}
	}
</script>

<style>
	page {
		background-color: #f0efee;
	}

	.bb {
		border: 1rpx solid #f3f3f3;
	}
</style>